<?php

/**
 * WeEngine System
 *
 * (c) We7Team 2021 <https://www.w7.cc>
 *
 * This is not a free software
 * Using it under the license terms
 * visited https://www.w7.cc for more details
 */

namespace W7\Addons\demo_laravel_wechat\Upgrade101;

use W7\Sdk\OpenCloud\Contracts\ModuleUpgradeInterface;

class Up implements ModuleUpgradeInterface
{
    public function database(): array
    {
        $sql[] = <<<EOF
CREATE TABLE IF NOT EXISTS `ims_demo_pay_log`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `account_id` int(11) NOT NULL DEFAULT 0 COMMENT '所属号码',
  `out_trade_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '订单号',
  `pay_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '支付类型',
  `amount` decimal(11, 2) NOT NULL DEFAULT 0.00 COMMENT '支付金额',
  `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态 0 未支付 1已支付 2已退款',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
EOF;
        return $sql;
    }

    public function script(): bool
    {
        return true;
    }
}
